package com.yang.concurrency.chapter2;

/**
 * @Author: 血魔
 * @Date: Created in 13:03 2021/12/12
 * @Version: 1.0$
 */
public class TaxCalaculator {
    private final double salary;
    private final double bonus;
    private CalculatorStrategy calculatorStrategy;

    public TaxCalaculator(double salary, double bonus){
        this.salary=salary;
        this.bonus=bonus;
    }

    public TaxCalaculator(double salary, double bonus, CalculatorStrategy calculatorStrategy) {
        this.salary = salary;
        this.bonus = bonus;
        this.calculatorStrategy = calculatorStrategy;
    }

    public double calcTax(){
        return calculatorStrategy.calculate(salary, bonus);
    }

    public double calculate(){
        return this.calcTax();
    }

    public double getSalary() {
        return salary;
    }

    public double getBonus() {
        return bonus;
    }

    public void setCalculatorStrategy(CalculatorStrategy calculatorStrategy) {
        this.calculatorStrategy = calculatorStrategy;
    }
}
